<%@ page session="true" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
  <c:choose> 
  <c:when test='${code == "+OK"}'>  
 
 
 <div style="height:100px;background-image:url('images/bgs/profiletop.jpg');font-size:2em;color:white;text-align:center;">
&nbsp;
</div>
<div style="height:200px;background-image:url('images/bgs/profilebg.jpg');color:black;">
<div id="user-info" style="font-size:2.5em;margin:0px;padding:2px;">
<img src="https://graph.facebook.com/${pid}/picture?type=square"/> ${fname}
</div>

<div align="left" style="font-size:1.5em;border: 2px brown silver;margin:4px;padding:2px;">
Country : ${nationality}
</div>

<div align="left" style="font-size:1.5em;border: 2px brown silver;margin:4px;padding:2px;">
Level : ${level}
</div>
<div align="right">
<button id="attackbutton" style="width:150px;height:50px;"> Attack </button>
</div>
</div>
<div style="height:42px;background-image:url('images/bgs/profilebottom.jpg');">
&nbsp;
</div>

 
	
	

<div id="dialog-message" title="Attack">

</div>


<script language="javascript">
//location id
var locID=${locID};
//ID of the enemy
var pid=${pid};
function initEnemy() {
 $(".enemyinfo tr").mouseover(function() {
		$(this).addClass("statsover");
	}).mouseout(function() {
		$(this).removeClass("statsover");
	});
		
		$('#attackbutton').bind('click',function(event) {
//Attempt to see if the user has any army
var totalArmy=0;
for(var i=0;i<MAX_MIL_RES;i++)
{
totalArmy+=mresources[i];
}
if(totalArmy<1)
{
jAlert("You have no army to fight this war! <br> Create an army first or undeploy army from your satellite cities and then attempt to conquer other territories","No Army!");
}
			
			// FIXME. Add War animation here!
		$('#dialog-message').html("<img src='images/battle/battle.gif'>");
		$('#dialog-message').load('war/attackterritory', {
			locID : locID,
			pid:pid
		});
		
		$('#dialog-message').dialog('open');
	});
	
$("#dialog-message").dialog({
			modal: true,
			autoOpen: false,
			show: 'blind',
			hide: 'explode',
			width:750,
			height:350,
			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		});


}
initEnemy();
</script>
 </c:when> 
 <c:otherwise>  
 
Uh oh! Some one already beat you to this location. 
Think fast. Act faster!
<script language="javascript">
showWarLocations();
</script>
 </c:otherwise> 
 </c:choose> 
